package git

import (
	"devops/pkg/git/git_model"
	"devops/pkg/git/gitea_sdk"
	"devops/pkg/git/gitee_sdk"
	"devops/pkg/git/github_sdk"
	"devops/pkg/git/gitlab_sdk"
)

type GitCli interface {
	GetBranches(owner string, repo string) []git_model.Branch
	GetRepos() ([]git_model.Repo, error)
}

func NewGitCli(scm string, token string, baseUrl string) GitCli {
	var cli GitCli

	switch scm {
	case "gitee":
		cli = gitee_sdk.NewGiteeClient(token)
	case "github":
		cli = github_sdk.NewGithubClient(token)
	case "gitea":
		cli = gitea_sdk.NewGiteaClient(token, baseUrl)
	case "gitlab":
		cli = gitlab_sdk.NewGitlabClient(token, baseUrl)
	}
	return cli
}
